package com.foruo.learn.jvisualvm;

/**
 * 监控内存
 *
 * 主要测试堆溢出的情况 Java heap space
 *
 * 在溢出之前点击 堆dump
 *
 * @author GaoYuan
 * @date 2018/5/28 上午10:01
 */
public class TestMemory {

    StringBuffer stringBuffer = new StringBuffer();

    public TestMemory(int index){
        int i = 0;
        while (i< index){
            i++;
            try {
                stringBuffer.append("a");
            }catch (Exception e){
                e.printStackTrace();
                break;
            }
        }
    }


    public static void main(String[] args){
        new TestMemory(2000000000);
    }
}
